package com.dean.batch.entity;

import java.util.Map;

/**
 * @ClassName DeanBatchJobDepend
 * @Description batch job depend
 * @Author dean
 * @Date 2021/12/16 12:28
 */
public class SysBatchJobDepend implements BaseEntity{
    private final String JOB_ID = "JOB_ID";
    private final String DEPEND_TYPE = "DEPEND_TYPE";
    private final String DEPEND_JOB_ID = "DEPEND_JOB_ID";

    // jobId
    private String jobId;
    // 依赖类型 UP-上游  DOWN-下游节点
    private String dependType;
    // 依赖jobid
    private String dependJobId;

    public String getJobId() {
        return jobId;
    }

    public void setJobId(String jobId) {
        this.jobId = jobId;
    }

    public String getDependType() {
        return dependType;
    }

    public void setDependType(String dependType) {
        this.dependType = dependType;
    }

    public String getDependJobId() {
        return dependJobId;
    }

    public void setDependJobId(String dependJobId) {
        this.dependJobId = dependJobId;
    }

    /**
     * 设置指定的字段信息
     * @param fieldName
     * @param fieldValue
     */
    public void set(String fieldName,Object fieldValue) {
        fieldName = fieldName.toUpperCase();
        String value = fieldValue == null ? null : String.valueOf(fieldValue);
        switch (fieldName) {
            case JOB_ID:
                setJobId(value);
                break;
            case DEPEND_TYPE:
                setDependType(value);
                break;
            case DEPEND_JOB_ID:
                setDependJobId(value);
                break;
            default:
                break;
        }
    }

//    /**
//     * 将map转为实体类
//     * @param map
//     */
//    public void set(Map<String,Object> map){
//        map.forEach((key,val)->{
//            set(key,val);
//        });
//    }
}
